home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5965 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.7 KB

  1. Path: manawatu.planet.co.nz!news
  2. From: ctutty@manawatu.gen.nz (Chris Tutty)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: How to tell if a file exists in C
  5. Date: Thu, 22 Feb 1996 05:39:09 GMT
  6. Organization: PlaNet (NZ) Manawatu, Palmerston Nth, New Zealand +64 6 357-9245
  7. Message-ID: <4ggsa4$cdp@news.manawatu.gen.nz>
  8. References: <4eqkj6$ipo@charm.magnus.acs.ohio-state.edu> <4eqn9q$dr1@sparcserver.lrz-muenchen.de> <3121db3e.43150046@nntp.ix.netcom.com> <4ftpnk$i74@cafu.fl.net.au> <824493561snz@genesis.demon.co.uk> <4g8132$mg9@cafu.fl.net.au>
  9. NNTP-Posting-Host: ctutty.manawatu.gen.nz
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=iso-8859-1
  12. Content-Transfer-Encoding: 8bit
  13. X-Newsreader: Forte Free Agent v0.55
  14.  
  15. als@fl.net.au (Andrew Snow) wrote:
  16. >Lawrence Kirby <fred@genesis.demon.co.uk> wrote:
  17. >>In article <4ftpnk$i74@cafu.fl.net.au> als@fl.net.au "Andrew Snow" writes:
  18. >>>If you want to see if the file is readable as well as exists,
  19. >>Can a file be readable yet not exist?
  20. >No, but did you really want me to spell it out?  You ought to have
  21. >been able to figure it out. Sorry if you couldn't.
  22. >
  23. That's what I need!!! :-)  Non-existent readable files.  Simplify your
  24. testing, avoid cluttering your hard drive with files called
  25. TEMP001.TMP!.   Yeah!  
  26.  
  27. Ok, now we need an operating system that implements it.  Hmmm, maybe
  28. opening the serial port and attaching a terminal with a monkey at the
  29. keyboard.  Keep running the program until the monkey generates a text
  30. string that doesn't trigger any errors and voila! - there's your test
  31. file.  Nope - damn, then it would exist which violates the original
  32. premise.
  33.  
  34. Well, actually I know what you mean, but I'm not sure that Mr Kirby's
  35. 'Can a file be readable but not exist' is actually impossible.  I
  36. remember a situation connecting to a server from Windows where a user
  37. could save files to the server, but didn't have rights to view the
  38. directory.  The file was writable (and therefore readable) as long as
  39. it was open, but once closed, it no longer existed for that person.
  40. Don't remember the details, but we had to kick our way through several
  41. layers of interacting permissions to sort it out.
  42.  
  43. In fact, after coding my way through the maze of error values and
  44. security issues for accessing files from MSWord, VB and C on local and
  45. network drives I'm damn close to writing a small DLL which returns a
  46. useful value without triggering 'drive not connected' errors, or
  47. locking up while the machine waits for the CDROM to return, or tells
  48. the user that their file doesn't exist, when what's happened is
  49. they've spelt the directory name wrong, etc, etc, etc.
  50.  
  51.  
  52. If anyone knows of a commercial tool that can do an intelligent file
  53. open past network drives, removable media and sharing violations,
  54. please let me know.
  55.  
  56. Chris
  57. ctutty@manawatu.gen.nz
  58.  
  59.